//
//  THBabySeriviceTableViewCell.m
//  TreeHole
//
//  Created by apple on 2020/9/21.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "THBabyMajorUserTableViewCell.h"
#import "STTools_XingXIngView.h"
@interface THBabyMajorUserTableViewCell()
@property(nonatomic, strong) UIImageView                     *iconImageView;/**<  */
@property(nonatomic, strong) STLabel                     *nameLable;/**<  */
@property(nonatomic, strong) STLabel                     *priceLable;/**<  */
@property(nonatomic, strong) STLabel                     *ageLable;/**<  */
@property(nonatomic, strong) STLabel                     *disLable;/**<  */

@property(nonatomic, strong) STTools_XingXIngView                     *xingxingView;/**<  */
@end
@implementation THBabyMajorUserTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self stoneobs_ui_configSubView];
    }
    return self;
}
+ (CGFloat)stoneobs_ui_cell_height{
    return 95;
}
#pragma mark --configSubView
- (void)stoneobs_ui_configSubView{
    UIImageView * stoneobs_ui_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 50, 50)];
    stoneobs_ui_imageView.image = [UIImage imageNamed:@"ic_none"];
    [self.contentView addSubview:stoneobs_ui_imageView];
    self.iconImageView = stoneobs_ui_imageView;
    stoneobs_ui_imageView.layer.cornerRadius = 25;
    stoneobs_ui_imageView.clipsToBounds = YES;
    CGFloat left = stoneobs_ui_imageView.right + 10;
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(left, stoneobs_ui_imageView.top, 200, 20)
                                                                text:@"sasd"
                                                           textColor:STONEOBS_UI_FIRST_TEXT_COLOR
                                                                font:15
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:stoneobs_ui_label];
        self.nameLable = stoneobs_ui_label;
    });
    
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(left, stoneobs_ui_imageView.top, 200, 20)
                                                                text:@"sasd"
                                                           textColor:WH_UICOLOR_FROM_RGBA(0xFF6955)
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentRight];
        [self.contentView addSubview:stoneobs_ui_label];
        self.priceLable = stoneobs_ui_label;
        stoneobs_ui_label.right = UISCREEN_WIDTH - 15;
    });
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(left, self.nameLable.bottom + 5, 200, 20)
                                                                text:@"预售"
                                                           textColor:STONEOBS_UI_SECEND_TEXT_COLOR
                                                                font:10
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:stoneobs_ui_label];
        self.ageLable = stoneobs_ui_label;
        stoneobs_ui_label.bottom = self.iconImageView.bottom;
    });
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(left, self.iconImageView.bottom + 5, 200, 20)
                                                                text:@"预售"
                                                           textColor:STONEOBS_UI_THIRD_TEXT_COLOR
                                                                font:10
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:stoneobs_ui_label];
        self.disLable = stoneobs_ui_label;

        
        STTools_XingXIngView * xingxing = [[STTools_XingXIngView alloc] initWithFrame:CGRectMake(0, 0, 22*5, 22) maxsNum:5];
        xingxing.userInteractionEnabled = NO;
        [self.contentView addSubview:xingxing];
        xingxing.centerY = stoneobs_ui_label.centerY;
        self.xingxingView = xingxing;
    });
    
    STButton * stoneobs_ui_button = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 58, 24)
                                                              title:@"预约服务"
                                                         titleColor:UIColor.whiteColor
                                                          titleFont:12
                                                       cornerRadius:12
                                                    backgroundColor:STONEOBS_UI_THEME_BACKGROUNDCOLOR
                                                    backgroundImage:nil
                                                              image:nil];
    self.addButton = stoneobs_ui_button;
    stoneobs_ui_button.userInteractionEnabled = NO;
    stoneobs_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    stoneobs_ui_button.right = UISCREEN_WIDTH - 15;
    [self.contentView addSubview:stoneobs_ui_button];
    stoneobs_ui_button.bottom = self.class.stoneobs_ui_cell_height - 10;
}
- (void)setModel:(THMajorUserModel *)model{
    _model = model;
    [self.iconImageView sd_setImageWithURL:model.header_img.mj_url];
    self.nameLable.text = model.real_name;
    self.priceLable.text = [NSString stringWithFormat:@"￥%@",model.price];
    self.ageLable.text = [NSString stringWithFormat:@"职业年龄:%@",model.job_age];
    self.disLable.text = [NSString stringWithFormat:@"距离我%@",model.distance];
    self.xingxingView.hidden = YES;
    [NSString stoneobs_fun_lableAutoAdjustWitdhWithLabel:self.disLable];
}
- (void)showXingXingView{
    self.xingxingView.hidden = NO;
    self.disLable.text = @"星级:";
    [NSString stoneobs_fun_lableAutoAdjustWitdhWithLabel:self.disLable];
    self.xingxingView.left = self.disLable.right+5;
    [self.xingxingView stoneobs_fun_st_makeXingXingSelectedWithNum:self.model.star.intValue];
    
}
@end
